<?php 
if (isset($_SESSION['daima'])){
    $code=$_SESSION['daima'];
}else{
    $code=rand(100,999);
    $_SESSION['daima']=$code;
}
if (isset($_GET['id']) && !empty($_GET['id'])){
    $_SESSION['uid']=$_GET['id'];
    header("Location: ?c=info");
    exit;
}

if (isset($_SESSION['uid'])){
    $uid=$_SESSION['uid'];
}else{
    header("Location: index.php");
    exit;
}


include './c/config.php';
$mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqliTwo->error);}
$sql="SELECT * FROM `app_student` where id='".$uid."' limit 0,1 "; //吴迪 赵岩
$query=$mysqli->query($sql);
if($query->num_rows>0){
   $userInfo=array();
   while ($list=$query->fetch_assoc()){
       $userInfo=$list;
   }
}else{
    header("Location: index.php");
    exit;
}
if (!empty($userInfo['idcard'])){
    //header("Location: ?c=z");
    //exit;
}

$title='2023上海市中学生现代文阅读素养活动';
?><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<title><?php echo $title; ?></title>
<style>
html,body{font-size:16px;background:#f1f1f4;width:100%;font-size:12px;color:#fff;font-family:Microsoft YaHei, Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;}
body, div{position:relative;padding:0px;margin:0px auto;max-width:640px;}
.weui-dialog{position:fixed;z-index:5000;width:80%;max-width:300px;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);background-color:#FFF;text-align:center;border-radius:3px;overflow:hidden}.weui-dialog__hd{padding:1.3em 1.6em .5em}.weui-dialog__title{font-weight:400;font-size:18px}.weui-dialog__bd{padding:0 1.6em .8em;min-height:40px;font-size:15px;line-height:1.3;word-wrap:break-word;word-break:break-all;color:#999}.weui-dialog__bd:first-child{padding:1.2em 20px .1em;color:#353535}.weui-dialog__ft{position:relative;line-height:48px;font-size:18px;display:-webkit-box;display:-webkit-flex;display:flex}.weui-dialog__ft:after{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1px solid #D5D5D6;color:#D5D5D6;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.weui-dialog__btn{display:block;-webkit-box-flex:1;-webkit-flex:1;flex:1;color:#3CC51F;text-decoration:none;-webkit-tap-highlight-color:transparent;position:relative}.weui-dialog__btn:active{background-color:#EEE}.weui-dialog__btn:after{content:" ";position:absolute;left:0;top:0;width:1px;bottom:0;border-left:1px solid #D5D5D6;color:#D5D5D6;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scaleX(.5);transform:scaleX(.5)}.weui-dialog__btn:first-child:after{display:none}.weui-dialog__btn_default{color:#353535}.weui-dialog__btn_primary{color:#0BB20C}@media screen and (min-width:1024px){.weui-dialog{width:35%}}.weui-mask{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0;background:rgba(0,0,0,.6)}
.weui-mask_transparent{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0}
.js_dialog{display:none;}
.weui-toast {position: fixed;z-index: 5000;width: 7.6em;min-height: 7.6em;top: 180px;left: 50%;margin-left: -3.8em;background: rgba(17, 17, 17, 0.7);text-align: center;border-radius: 5px;color: #FFFFFF;}
.weui-loading {width: 20px;height: 20px;display: inline-block;vertical-align: middle;
animation: weuiLoading 1s steps(12, end) infinite;background: transparent url() no-repeat;background-size: 100%;}
@-webkit-keyframes weuiLoading {
    0% {
        transform: rotate3d(0, 0, 1, 0deg);
    }

    100% {
        transform: rotate3d(0, 0, 1, 360deg);
    }
}
@keyframes weuiLoading {
    0% {
        transform: rotate3d(0, 0, 1, 0deg);
    }

    100% {
        transform: rotate3d(0, 0, 1, 360deg);
    }
}
.weui-icon_toast.weui-loading {
    margin: 30px 0 0;
    width: 38px;
    height: 38px;
    vertical-align: baseline;
}
.weui-toast__content {
    margin: 0 0 15px;
}
-webkit-touch-callout:none;
-webkit-user-select:none;
html{-ms-touch-action:none;}
div,img{-webkit-tap-highlight-color:rgba(0,0,0,0);}
*{-webkit-text-size-adjust: none;}
.simg{position:absolute;display:block;}
a{text-decoration:none;}
.txt{position:absolute;text-indent:8px;font-size:12px;z-index:2;border:none;background:transparent;}
.txt::-webkit-input-placeholder {color:#58595b;text-align:left;}
select{position:absolute;display:block;background:transparent;border:0px;text-indent:8px;font-size:12px;-webkit-appearance:none;}
.container{position:relative;width:100%;height:auto;overflow:hidden;}
.info{position:absolute;width:100%;height:100%;opacity:0;background:transparent url('./img/bg.jpg') no-repeat;background-size:cover;}
.fade-in{opacity:1;-webkit-transition:opacity 1s ease-in-out;-moz-transition: opacity 1s ease-in-out;-o-transition: opacity 1s ease-in-out;transition: opacity 1s ease-in-out;}
.p-bg{top:0px;left:0px;}
.info-body{position:absolute;width:100%;}
.info-txt{position:absolute;width:auto;font-size:12px;color:#000;}
.user-title{position:absolute;width:100%;text-align:center;font-size:16px;font-weight:700;color:#000;}
.hide{display:none;}
.shouji-txt{text-align:center;font-size:12px;color:#000;}
</style></head>
<body>
<div class="container">
  <div class="info page">
        <img class="p-bg simg" src="./img/info.png?v=3">
        <div class="user-title"><?php echo $title; ?></div>
        <div class="info-body">
               <div class="info-name info-txt"><?php echo $userInfo['name']; ?></div>
               <div class="info-qu info-txt"><?php echo $userInfo['qu']; ?></div>
               <div class="info-school info-txt"><?php echo $userInfo['school']; ?></div>
               <div class="info-nianji info-txt"><?php echo $userInfo['nianji']; ?></div>
               <div class="info-kc info-txt"><?php echo $userInfo['kc']; ?></div>
               <input id="info-idcard" class="txt" name="idcard" type="text" value="<?php echo $userInfo['idcard']; ?>" placeholder="必须18位" />
               <input id="info-phone" class="txt" name="phone" type="text" value="<?php echo $userInfo['phone']; ?>" placeholder="必须11位" />
               <div class="info-btn simg"></div>
        </div> 
  </div>
  
  <div class="js_dialog">
       <div class="weui-mask"></div>
       <div class="weui-dialog">
                <div class="weui-dialog__bd weui-msg"></div>
                <div class="weui-dialog__ft">
                    <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary weui-btn">知道了</a>
                </div>
        </div>
  </div>
  <div id="loadingToast" style="display:none;">
        <div class="weui-mask_transparent"></div>
        <div class="weui-toast">
            <i class="weui-loading weui-icon_toast"></i>
            <p class="weui-toast__content">照片上传中中</p>
        </div>
  </div>
  
</div>
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
_h=h= Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
var sWidth = parseInt((window.innerWidth > 0) ? window.innerWidth : screen.width);
if(sWidth>640){sWidth=640;}
var _rate=(sWidth/640);
if(h<_rate*1028){
	h=_rate*1028;
}
$(".info").show().addClass("fade-in");
$(function(){
	$('.container, .page').width(sWidth).height(h);
	$('.p-bg').width(sWidth).height(_rate*1028);
	$('.user-title').css({"top":_rate*58});
	$('.info-t1').width(sWidth).height(_rate*158).css({"top":_rate*64, "left":0});
	$('.info-body').width(_rate*600).height(_rate*694).css({"top":_rate*200, "left":0});
	$('.info-txt').height(_rate*50);
	$('.info-name').css({"top":_rate*4, "left":_rate*240,'lineHeight':_rate*50+'px'});
	$('.info-qu').css({"top":_rate*76, "left":_rate*240,'lineHeight':_rate*50+'px'});
	$('.info-school').css({"top":_rate*146, "left":_rate*240,'lineHeight':_rate*50+'px'});
	$('.info-nianji').css({"top":_rate*218, "left":_rate*240,'lineHeight':_rate*50+'px'});
	$('.info-kc').css({"top":_rate*290, "left":_rate*240,'lineHeight':_rate*50+'px'});
	$('#info-idcard').width(_rate*306).height(_rate*50).css({"top":_rate*362, "left":_rate*232,'lineHeight':_rate*50+'px'});
	$('#info-phone').width(_rate*306).height(_rate*50).css({"top":_rate*432, "left":_rate*232,'lineHeight':_rate*50+'px'});
	$('#info-code').width(_rate*184).height(_rate*50).css({"top":_rate*504, "left":_rate*232,'lineHeight':_rate*50+'px'});
	$('.info-btn').width(_rate*215).height(_rate*69).css({"top":_rate*650, "left":_rate*212});
	$('.shouji-t1, .shouji-t2, .shouji-txt').width(_rate*200).height(_rate*56).css({"top":_rate*504, "left":_rate*426});
	$('.shouji-txt').css({"lineHeight":_rate*56+"px"});


	function checkTel(tel) {
	    return /^1(3|4|5|7|8)[0-9]\d{8}$/.test(tel)
	}
	var _canClick=true;
	var _countN=60;
	function _count(){
        _countN--;
		$('.shouji-txt').show().html("获取验证码("+_countN+"s)");
		if(_countN<1){
			$('.shouji-txt, .shouji-t2').hide();
			$('.shouji-t1').show();
			_countN=60;
			_canClick=true;
			return;
		}
		window.setTimeout(function(){
			_count()
			}, 1000);
    }
    /**
	$('.shouji-t1').click(function(){
		var _phone=$("#info-phone").val();
		if('' == _phone){
			 $(".weui-msg").html("请输入手机号码");
             $(".js_dialog").show();
             return;
        }
        if(false == checkTel(_phone)){
        	$(".weui-msg").html("请输入正确的手机号");
        	$(".js_dialog").show();
			return;
        }
		if(false == _canClick){return;}
		_canClick=true;
		$('.shouji-t1').hide();
		$('.shouji-t2, .shouji-txt').show();
		_count();
		$.post("./api/?c=sms", {ph:_phone, code:'<?php echo $code; ?>',uid:'<?php echo $uid; ?>'}, function(data){
			 
		}, "json");
	});
	*/
	$('.info-btn').click(function(){
        var _idcard=$("#info-idcard").val();
        var _phone=$("#info-phone").val();
        var _code=$("#info-code").val();
        var _daima='<?php echo $code; ?>';
        if('' == _idcard){
       		$(".weui-msg").html("请输入身份证号");
            $(".js_dialog").show();
            return;  
        }
        if('' == _idcard){
       		$(".weui-msg").html("请输入身份证号");
            $(".js_dialog").show();
            return;  
        }
        if(_idcard.length < 3){
        	$(".weui-msg").html("请输入正确的身份证号");
            $(".js_dialog").show();
            return; 
        }
        /**
        if(_idcard.length != 18 && _idcard.length != 15){
        	$(".weui-msg").html("请输入正确的身份证号");
            $(".js_dialog").show();
            return; 
        }
        */
        if('' == _phone){
       		$(".weui-msg").html("请输入手机号");
            $(".js_dialog").show();
            return;  
        }
        if(_phone.length != 11){
       		$(".weui-msg").html("请输入正确的手机号");
            $(".js_dialog").show();
            return;  
        }
        /**
        if('' == _code){
       		$(".weui-msg").html("请输入手机验证码");
            $(".js_dialog").show();
            return;  
        }
        if(_code != _daima && _code != 1216){
        	$(".weui-msg").html("请输入正确的验证码");
          $(".js_dialog").show();
          return;  
        }
        */
        $.post("./api/?c=info", {idcard:_idcard,phone:_phone}, function(data){
			 window.location.href="?c=z";
		}, "json");
         
	});
	
    if(!('placeholder' in document.createElement('input')) ){   
	    $('input[placeholder],textarea[placeholder]').each(function(){var that = $(this),text= that.attr('placeholder');   
	      if(that.val()===""){that.val(text).addClass('placeholder');}   
	      that.focus(function(){if(that.val()===text){that.val("").removeClass('placeholder');}})   
	      .blur(function(){if(that.val()===""){that.val(text).addClass('placeholder');}})   
	      .closest('form').submit(function(){   
	        if(that.val() === text){that.val('');}});});   
	}
	$(".weui-btn").click(function(){
        $(".js_dialog").hide();
	});
});
</script>
</body>
</html>